<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.farm.web.constant.FarmConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<PF:basePath/>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${project.name }-<PF:ParameterValue
		key="config.sys.title" /></title>
<meta name="description"
	content='<PF:ParameterValue key="config.sys.mate.description"/>'>
<meta name="keywords"
	content='<PF:ParameterValue key="config.sys.mate.keywords"/>'>
<meta name="author"
	content='<PF:ParameterValue key="config.sys.mate.author"/>'>
<meta name="robots" content="index,follow">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<jsp:include page="../atext/include-web.jsp"></jsp:include>
<script src="text/lib/echarts/echarts.min.4.4.0.js"></script>
<script src="text/lib/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<style>
</style>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<!-- 导航 -->
			<jsp:include page="../commons/head.jsp"></jsp:include>
		</div>
	</div>
	<div class="container-fluid "
		style="background-color: #eceef1; padding-top: 80px; padding-bottom: 50px;">
		<div class="container" style="margin-bottom: 50px;">
			<div class="row">
				<div class="row">
					<div class="col-md-12" style="padding-bottom: 20px;">
						<jsp:include page="common/project-flow.jsp"></jsp:include>
					</div>
				</div>
				<div class="col-md-12" style="padding-bottom: 20px;">
					<div class="row">
						<div class="col-md-12"
							style="padding-bottom: 20px; min-height: 400px;">
							<div
								style="width: 100%; padding: 20px; border: 1px dashed #999999; background-color: #ffffff; border-radius: 1em;"
								id="projectFormBoxId"></div>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-12" style="padding-bottom: 20px;">
					<c:if test="${pagemodel=='debug' }">
						<jsp:include page="common/project-paremeters.jsp"></jsp:include></c:if>
				</div>
			</div>
		</div>
	</div>
	<div class="container-fluid" style="padding: 0px;">
		<!-- 页脚 -->
		<jsp:include page="../commons/foot.jsp"></jsp:include>
	</div>
</body>
<script type="text/javascript">
	var current
	$(function() {
		//加载默认页面
		loadForm();
		try {
			loadParas();
		} catch (e) {
		}
	});

	function loadForm() {
		$('#projectFormBoxId').load('prorun/loadForm.do?activeid=${active.id}');
	}
	//执行下一步
	function loadAndSubmitForm(tip) {
		let objectArray = [];
		$('.form-control', '#projectFormBoxId').each(function(i, obj) {
			if ($(obj).attr('type') == 'checkbox') {
				objectArray.push({
					name : $(obj).attr('name'),
					val : String($(obj).is(':checked'))
				});
			} else {
				objectArray.push({
					name : $(obj).attr('name'),
					val : $(obj).val()
				});
			}
		});
		if (confirm(tip ? tip : "是否提交当前表单?")) {
			$.post('prorun/submitForm.do', {
				'activeid' : '${active.id}',
				'paras' : JSON.stringify(objectArray)
			}, function(flag) {
				if (flag.STATE == 0) {
					//成功
					loadForm();
					try {
						loadParas();
						loadDebugInfo();
					} catch (e) {
					}
					init('${active.id}');
				} else {
					alert(flag.MESSAGE);
				}
			}, 'json');
		}
	}

	function submitParas() {
		loadAndSubmitForm();
	}
</script>
</html>